﻿namespace HuwmanCode.IO.Pipes

open System
open System.IO
open System.IO.Pipes

[<AutoOpen>]
module NamedPipeServerStreamExtension =
    type NamedPipeServerStream with
        member this.AsyncWaitForConnection () =
            Async.FromBeginEnd(this.BeginWaitForConnection, this.EndWaitForConnection)

        member this.WaitForConnection timeout =
            Async.RunSynchronously(this.AsyncWaitForConnection (), timeout=timeout)
            ()
